<template>
  <view class="content">
    <basic ref="basic" />
    <!-- <view class="tab">
      <tab @changeCurrent="changeCurrent" :tabList="tabList" :current="current" />
    </view> -->
    <!-- `calc(100vh - 90rpx)` -->
    <!-- <swiper :style="{ height: '100vh' }" :current="current" @change="swiperChange">
      <swiper-item>
        <basic v-if="currentList.indexOf(0) > -1" ref="basic" />
      </swiper-item> -->
    <!-- <swiper-item>
        <history v-if="currentList.indexOf(1) > -1" />
      </swiper-item> -->
    <!-- <swiper-item>
        <case v-if="currentList.indexOf(2) > -1" />
      </swiper-item> -->
    <!-- </swiper> -->
  </view>
</template>

<script>
import Tab from "@/components/tab/tab.vue";
import Basic from "./components/basic/basic.vue";
import History from "./components/history/history.vue";

export default {
  components: {
    Tab,
    Basic,
    History,
  },
  data() {
    return {
      tabList: ["基本信息", "病历信息", "生活习惯"],
      currentList: [],
      current: -1,
      patientId: "",
    };
  },
  watch: {
    // current(val) {
    //   if (this.currentList.indexOf(val) < 0) {
    //     setTimeout(
    //       () => {
    //         this.currentList.push(val);
    //       },
    //       this.currentList.length ? 500 : 0
    //     );
    //   }
    // },
  },
  onShareAppMessage() {
    return this.$util.returnShareObj();
  },
  onLoad(options) {
    // this.current = 0;
    this.$nextTick(() => {
      if (options.patientId) {
		  console.log(options.patientId,'====');
        this.patientId = options.patientId;
        uni.setNavigationBarTitle({ title: "患者档案" });
        this.$refs.basic.getPatient(this.patientId);
      } else if (options.add) {
        this.patientId = options.patientId;
        uni.setNavigationBarTitle({ title: "新增患者" });
        this.$refs.basic.doctorListNation({}, false);
      } else {
        this.$refs.basic.getPatient();
      }
    });
  },
  methods: {
    changeCurrent(current) {
      this.current = current;
    },
    swiperChange(e) {
      this.current = e.detail.current;
    },
  },
};
</script>
<style lang="scss" scoped>
.content {
  .tab {
    border-bottom: 1rpx solid $default-border-color;
    background: #ffffff;
  }
  .swiper {
    height: calc(100vh - 160rpx);
  }
}
</style>
